#ifndef RRCLIPPING_H
#define RRCLIPPING_H

#include "rrprim.h"
#include <stdint.h>

enum RRClipDir {RR_BOTTOM, RR_RIGHT, RR_TOP, RR_LEFT};

class RRClipping
{
private:
    int Xmax, Xmin, Ymax, Ymin;
    RRPrim *prim;
    RRPrim prim_bottom, prim_right, prim_top;
    uint8_t rrOutCode(float x, float y);
    void rrCohenSutherland(RRVertex s, RRVertex t, float Xp, float Yp, float Xq, float Yq);
    void rrSutherlandHodgman(RRPrim *src);
    void rrComputeInterpolation(RRVertex s, RRVertex t, float X, float Y, RRClipDir dir);
    void rrClipEdge(RRVertex s, RRVertex t, RRClipDir dir);

public:
    explicit RRClipping();
    void rrClipping(RRPrim *src, RRPrim *dest);
};

#endif // RRCLIPPING_H
